package com.cooba.dialog;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;

import com.cooba.R;


public class SelectPhotoDialog {

	private Context context;
	private MyBaseDialog dialog;

	private View contentView;
	private RelativeLayout btn_takePicture, btn_fromGallery,btn_cancel;

	public SelectPhotoDialog(Context context) {
		this.context = context;
		init();
	}

	private void init() {
		dialog = new MyBaseDialog(context);

		contentView = LayoutInflater.from(context).inflate(
				R.layout.dialog_select_photo, null);

		btn_takePicture = (RelativeLayout) contentView
				.findViewById(R.id.user_info_setting_dialog_select_photo_btn_takePicture);
		btn_fromGallery = (RelativeLayout) contentView
				.findViewById(R.id.user_info_setting_dialog_select_photo_btn_fromGallery);

		btn_cancel = (RelativeLayout) contentView
				.findViewById(R.id.user_info_setting_dialog_select_photo_btn_cancel);

		dialog.setCanceledOnTouchOutside(true);
		dialog.setContentView(contentView);
	}

	public void setNegativeButton(OnClickListener clickListener) {
		if (clickListener == null) {
			btn_cancel.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					dialog.dismiss();
				}
			});
		} else {
			btn_cancel.setOnClickListener(clickListener);
		}
	}

	public void setOnItemClickListener(OnClickListener clickListener) {
		btn_takePicture.setOnClickListener(clickListener);
		btn_fromGallery.setOnClickListener(clickListener);
	}

	public void show() {
		dialog.show();
	}

	public boolean isShowing() {
		return dialog.isShowing();
	}

	public void dismiss() {
		dialog.dismiss();
	}
}
